<script setup lang="ts">
defineProps({
  active: {
    type: Boolean,
    default: false
  }
})
defineEmits(['edit', 'delete'])
</script>

<template>
  <div class="aside-list" :class="{ active: active }">
    <span class="title"><slot /></span>
    <el-button text size="small" type="primary" @click.stop="$emit('edit')" style="margin-left: auto; padding: 5px">
      <el-icon :size="12"> <Edit /> </el-icon>
    </el-button>
    <span @click.stop="() => {}">
      <el-popconfirm title="是否确认删除?" :width="150" @confirm="$emit('delete')">
        <template #reference>
          <el-button text size="small" type="primary" style="padding: 5px">
            <el-icon :size="12"> <Close /> </el-icon>
          </el-button>
        </template>
      </el-popconfirm>
    </span>
  </div>
</template>

<style lang="scss" scoped>
.aside-list {
  cursor: pointer;
  border-bottom: 1px solid #f4f4f4;
  display: flex;
  align-items: center;
  padding: 10px;
  //  font-size: 16px;
  color: #666;
  .title {
    // width: 100px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    -o-text-overflow: ellipsis;
  }
}
.aside-list:hover,
.active {
  background-color: rgb(187, 219, 245);
}
</style>
